package com.hao.chatdemo.config;

import com.corundumstudio.socketio.SocketIOServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * TODO
 * CommandLineRunner是springboot启动的接口
 * StartupRunner是启动服务类
 * @author 97472
 * @version 1.0
 * @date 2021/7/7 16:40
 */
@Component
@Order(1)
public class StartupRunner implements CommandLineRunner {
    private SocketIOServer socketIOServer;

    @Autowired
    public void setSocketIOServer(SocketIOServer socketIOServer) {
        this.socketIOServer = socketIOServer;
    }

    @Override
    public void run(String... args) throws Exception {
        socketIOServer.start();
    }
}
